<template>
	<view>
		<view class="">
			<!-- 2.0.19支持autoBack，默认为false -->
			<u-navbar leftText="通知公告" :autoBack="true">
			</u-navbar>
		</view>
		<view class="con-body">
			<view style="background-color:#fff;border-radius: 8rpx;padding:20rpx 0;margin-top:10rpx;overflow: hidden;">
				<u-empty :show="showEmpty" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
				</u-empty>
				<view style="padding:20rpx;" v-for="(item,index) in notice" :key="index" @click="detail(item.id)">
					<view class="dis_inl_blo va_m">
						<u-icon name="https://resourse.cnlhjt.com/upload/20220825/7513d671b2b5c928b3bbd12fc6ce46bc.png" color="#008987" size="18"></u-icon>
					</view>
					<text class="va_m overflow dis_inl_blo" style="margin-left:20rpx;color:#333;font-size: 28rpx;width:65%;">{{item.content}}</text>
					<text style="float: right;font-size: 25rpx;color:#999;">{{item.time}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getNoticeList
	} from "@/service/noticeService.js";
	export default{
		data () {
			return{
				showEmpty:false,
				notice:[]
			}
		},
		mounted() {
			getNoticeList({
				page:1,limit:20
			}).then(this.getNotice);
		},
		methods:{
			detail(id){
				this.$u.route({
					url: '/pagesHome/index/notice',
					params: {
						id: id
					}
				})
			},
			getNotice(e) {
				if (e.code == 200) {
					this.notice = e.result;
					this.showEmpty=false
				}else{
					this.notice = [];
					this.showEmpty=true
				}
			},
		}
	}
</script>

<style lang="scss">
</style>
